﻿namespace QLPhongKham.UC
{
    using ConfigDatabase.Class;
    using DevExpress.Utils;
    using DevExpress.XtraEditors;
    using DevExpress.XtraTab;
    using QLPhongKham.Access.VienPhi;
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    public class ucvp_thongso : XtraUserControl
    {
        private ConnectDatabase _condata;
        private VPThongSo _tsvp;
        private SimpleButton btnketthuc;
        private SimpleButton btnluu;
        private CheckBox chkcm_a1;
        private IContainer components = null;
        private Label label25;
        private XtraTabPage tabquanly;
        private ToolTipController toolTipController1;
        private XtraTabControl xtraTabControl1;

        public ucvp_thongso()
        {
            this.InitializeComponent();
        }

        private void btnketthuc_Click(object sender, EventArgs e)
        {
            try
            {
                XtraTabPage parent = (XtraTabPage) base.Parent;
                XtraTabControl control = (XtraTabControl) parent.Parent;
                control.TabPages.Remove(parent);
            }
            catch
            {
                try
                {
                    XtraUserControl control2 = (XtraUserControl) base.Parent;
                    control2.Controls.Remove(this);
                }
                catch
                {
                    ((Form) base.Parent).Close();
                }
            }
        }

        private void btnluu_Click(object sender, EventArgs e)
        {
            this.f_thongso_save(0);
            MessageBox.Show("Lưu th\x00e0nh c\x00f4ng.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK);
        }

        private void cbbdangnhap_EditValueChanged(object sender, EventArgs e)
        {
            try
            {
                this.f_thongso_load(0);
            }
            catch
            {
                this.f_thongso_load(0);
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void f_loaddata_dmdangnhap()
        {
        }

        private void f_thongso_load(int iddangnhap)
        {
            this.chkcm_a1.Checked = this._tsvp.pVP_A1_QuanLyQuyenSo;
        }

        private void f_thongso_save(int iddangnhap)
        {
            this._tsvp.pVP_A1_QuanLyQuyenSo = this.chkcm_a1.Checked;
        }

        private void InitializeComponent()
        {
            this.components = new Container();
            ComponentResourceManager manager = new ComponentResourceManager(typeof(ucvp_thongso));
            this.btnketthuc = new SimpleButton();
            this.btnluu = new SimpleButton();
            this.label25 = new Label();
            this.xtraTabControl1 = new XtraTabControl();
            this.tabquanly = new XtraTabPage();
            this.chkcm_a1 = new CheckBox();
            this.toolTipController1 = new ToolTipController(this.components);
            this.xtraTabControl1.BeginInit();
            this.xtraTabControl1.SuspendLayout();
            this.tabquanly.SuspendLayout();
            base.SuspendLayout();
            this.btnketthuc.Anchor = AnchorStyles.Bottom;
            this.btnketthuc.Appearance.Options.UseTextOptions = true;
            this.btnketthuc.Appearance.TextOptions.HAlignment = HorzAlignment.Near;
            this.btnketthuc.Image = Properties.Resources.imgclose;// (Image)manager.GetObject("btnketthuc.Image");
            this.btnketthuc.Location = new Point(0x15a, 0x189);
            this.btnketthuc.Name = "btnketthuc";
            this.btnketthuc.Size = new Size(0x4f, 0x17);
            this.btnketthuc.TabIndex = 3;
            this.btnketthuc.Text = " &Kết th\x00fac";
            this.btnketthuc.Click += new EventHandler(this.btnketthuc_Click);
            this.btnluu.Anchor = AnchorStyles.Bottom;
            this.btnluu.Appearance.Options.UseTextOptions = true;
            this.btnluu.Appearance.TextOptions.HAlignment = HorzAlignment.Near;
            this.btnluu.Image = Properties.Resources.imgsave;// (Image)manager.GetObject("btnluu.Image");
            this.btnluu.Location = new Point(0x117, 0x189);
            this.btnluu.Name = "btnluu";
            this.btnluu.Size = new Size(0x3f, 0x17);
            this.btnluu.TabIndex = 2;
            this.btnluu.Text = " &Lưu";
            this.btnluu.Click += new EventHandler(this.btnluu_Click);
            this.label25.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.label25.BackColor = Color.Green;
            this.label25.Font = new Font("Tahoma", 16f);
            this.label25.ForeColor = Color.White;
            this.label25.Location = new Point(0, 0);
            this.label25.Name = "label25";
            this.label25.Size = new Size(0x2de, 0x2d);
            this.label25.TabIndex = 0x1a;
            this.label25.Text = "TH\x00d4NG SỐ";
            this.label25.TextAlign = ContentAlignment.MiddleLeft;
            this.xtraTabControl1.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
            this.xtraTabControl1.Location = new Point(0, 0x2f);
            this.xtraTabControl1.Name = "xtraTabControl1";
            this.xtraTabControl1.SelectedTabPage = this.tabquanly;
            this.xtraTabControl1.Size = new Size(0x2db, 340);
            this.xtraTabControl1.TabIndex = 0x1b;
            this.xtraTabControl1.TabPages.AddRange(new XtraTabPage[] { this.tabquanly });
            this.tabquanly.Controls.Add(this.chkcm_a1);
            this.tabquanly.Name = "tabquanly";
            this.tabquanly.Size = new Size(0x2d5, 0x138);
            this.tabquanly.Text = "Quản l\x00fd";
            this.chkcm_a1.AutoSize = true;
            this.chkcm_a1.Font = new Font("Tahoma", 10f);
            this.chkcm_a1.Location = new Point(4, 13);
            this.chkcm_a1.Name = "chkcm_a1";
            this.chkcm_a1.Size = new Size(0x9f, 0x15);
            this.chkcm_a1.TabIndex = 2;
            this.chkcm_a1.Text = "A1. Quản l\x00fd quyển sổ";
            this.chkcm_a1.UseVisualStyleBackColor = true;
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.Controls.Add(this.xtraTabControl1);
            base.Controls.Add(this.label25);
            base.Controls.Add(this.btnluu);
            base.Controls.Add(this.btnketthuc);
            this.LookAndFeel.UseWindowsXPTheme = true;
            base.Name = "ucvp_thongso";
            base.Size = new Size(0x2de, 0x1a3);
            base.Load += new EventHandler(this.UCphanquyensudung_Load);
            this.xtraTabControl1.EndInit();
            this.xtraTabControl1.ResumeLayout(false);
            this.tabquanly.ResumeLayout(false);
            this.tabquanly.PerformLayout();
            base.ResumeLayout(false);
        }

        private void UCphanquyensudung_Load(object sender, EventArgs e)
        {
            if (this._condata == null)
            {
                this._condata = new ConnectDatabase();
            }
            this._tsvp = new VPThongSo(this._condata);
            this.f_thongso_load(0);
        }

        public ConnectDatabase pCondata
        {
            get
            {
                return this._condata;
            }
            set
            {
                this._condata = value;
            }
        }
    }
}

